import { http } from "@/utlis/http";
/**
 * 添加收货地址
 * @param data 请求参数
 */
export const postMemberAddressAPI = (data: any) => {
  return http({
    method: "POST",
    url: "/address/create",
    data,
  });
};

/**
 * 获取收货地址列表
 */
export const getMemberAddressAPI = () => {
  return http({
    method: "GET",
    url: "/address/list",
  });
};

/**
 * 获取收货地址详情
 * @param id 地址id(路径参数)
 */
export const getMemberAddressByIdAPI = (id: string) => {
  return http({
    method: "GET",
    url: `/address/${id}`,
  });
};

/**
 * 修改收货地址
 * @param id 地址id(路径参数)
 * @param data 表单数据(请求体参数)
 */
export const putMemberAddressByIdAPI = (id: string, data: any) => {
  return http({
    method: "PUT",
    url: `/address/${id}`,
    data,
  });
};

/**
 * 删除收货地址
 * @param id 地址id(路径参数)
 */
export const deleteMemberAddressByIdAPI = (id: string) => {
  return http({
    method: "DELETE",
    url: `/address/${id}`,
  });
};
